package com.unicom.si.security.config;

import org.springframework.lang.Nullable;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;

public class MvcWebApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {

    // 把spring security的配置加到ApplicationInitializer，我觉得就是把spring security加入到根容器里
    // 和xml里的import 类似？？
    @Nullable
    protected Class<?>[] getRootConfigClasses() {

        return new Class[0];
//        return new Class[] {WebSecurityConfig.class};
    }

    // 这个是用来加载spring MVC的配置类的,相当于指明spring-mvc.xml对应的配置类
//    <servlet>
//        <servlet-name>SpringMVC</servlet-name>
//        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
//        <init-param>
//            <param-name>contextConfigLocation</param-name>
//            <param-value>classpath*:spring-mvc.xml</param-value>
//        </init-param>
//        <load-on-startup>1</load-on-startup>
//    </servlet>
    @Nullable
    protected Class<?>[] getServletConfigClasses() {
        return new Class[0];
    }

    // 相当于spring MVC 在web.xml里配置的
//    <servlet-mapping>
//        <servlet-name>SpringMVC</servlet-name>
//        <url-pattern>/</url-pattern>
//    </servlet-mapping>
    protected String[] getServletMappings() {
//        return new String[] {"/"};
        return new String[0];
    }
}
